<template>
  <view class="mine-page bg-mine">
    <button class="mine-head" @click="toLogin">
      <image class="user-img" :src="userStore.userInfo?.avatar || getImageSrc('static/icons/user-head.png')"></image>
      <view class="head-txt">
        <view class="user-name">{{ userStore.userInfo?.nickname || "请登录查看" }}</view>
        <view class="user-phone" v-if="userStore.userInfo?.mobile">{{ userStore.userInfo?.mobile }}</view>
      </view>
    </button>

    <view class="mine-card">
      <Title title="车主服务"></Title>
      <view class="fuwu-list">
        <button class="fuwu-item" @click="navTo('/pages/mine/appointment-log/index')">
          <image class="fw-icon" :src="getImageSrc('static/mine/yuyuejilu.png')"></image>
          <view>预约记录</view>
        </button>
        <button class="fuwu-item" @click="navTo('/pages/mine/order/index')">
          <image class="fw-icon" :src="getImageSrc('static/mine/wodedingdan.png')"></image>
          <view>我的订单</view>
        </button>
        <button class="fuwu-item" @click="navTo('/pages/mine/my-car/index')">
          <image class="fw-icon" :src="getImageSrc('static/mine/wodeqiche.png')"></image>
          <view>我的车辆</view>
        </button>
        <button class="fuwu-item" @click="navTo('/pages/mine/appointment/index')">
          <image class="fw-icon" :src="getImageSrc('static/mine/shouhouyuyue.png')"></image>
          <view>售后预约</view>
        </button>
      </view>
    </view>
    <view class="mine-card">
      <Title title="售后服务"></Title>
      <view class="fuwu-list">
        <!-- <button class="fuwu-item" @click="navTo('/pages/mine/appointment-log/index', { status: '2' })">
          <image class="fw-icon" :src="getImageSrc('static/mine/fuwujilu.png')"></image>
          <view>服务记录</view>
        </button> -->
        <button class="fuwu-item" open-type="contact">
          <image class="fw-icon" :src="getImageSrc('static/mine/lianxiwomen.png')"></image>
          <view>联系我们</view>
        </button>
          <!-- <button class="fuwu-item" open-type="feedback">
          <image class="fw-icon" src="/static/icons/option.png"></image>
          <view>意见反馈</view>
        </button> -->
      </view>
    </view>

    <image class="mine-banner" :src="itm.image" v-for="(itm, idx) in adList" :key="idx" @click="toDetail(itm)"></image>
  </view>
</template>


<script setup>
import { ref ,onMounted} from "vue"
import Title from "@/components/ui/title"
import { useUserInfoStore } from '@/path/store/userInfo';
import { router } from "@/path/router";
import { toDetail } from "../index/data"
import { getImageSrc } from '@/path/until';
import service from "@/path/service"
const userStore = useUserInfoStore()

const adList = ref([])
service.get("api/ycg/home/banner", { pageType: 3 }).then(res => adList.value = res)
function toLogin() {
  router.navigate({ url: "/pages/mine/set-user/index" })
}
function navTo(url, params) {
  if (!url) return
  router.navigate({
    url
  }, {
    data: params
  })
}
onMounted(() => {

})
</script>

<style lang="less" scoped>
@import url(./index.less);
</style>